package model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import util.SMSUtil;

public class Contract extends SMSObject {
	
	private double cost;
	private Date startDate;
	private Date endDate;
	private int duration;
	private String description;
	private String status;
	private Date signedDate;
	private String shippingAddress;
	private String  billingAddress;
	private int currentLevel = 0;
	private long maxLevel = 0;
	private long nextApprover = 0;
	private List<Long> approvers = new ArrayList<Long>();
	

	
	public void setCurrentLevel(int level) {
		this.currentLevel = level;
	}
	public int getCurrentLevel() {
		return currentLevel;
	}	
	
	public double getCost() {
		return cost;
	}
	public void setCost(double cost) {
		this.cost = cost;
	}
	public Date getStartDate() {
		return startDate;
	}
	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}
	public Date getEndDate() {
		return endDate;
	}
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}
	public int getDuration() {
		return duration;
	}
	public void setDuration(int duration) {
		this.duration = duration;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public Date getSignedDate() {
		return signedDate;
	}
	public void setSignedDate(Date signedDate) {
		this.signedDate = signedDate;
	}
	public String getShippingAddress() {
		return shippingAddress;
	}
	public void setShippingAddress(String shippingAddress) {
		this.shippingAddress = shippingAddress;
	}
	public String getBillingAddress() {
		return billingAddress;
	}
	public void setBillingAddress(String billingAddress) {
		this.billingAddress = billingAddress;
	}
	
	public long getMaxLevel() {
		return maxLevel;
	}
	public void setMaxLevel(long maxLevel) {
		this.maxLevel = maxLevel;
	}
	
	public long getNextApprover() {
		return nextApprover;
	}
	public void setNextApprover(long nextApprover) {
		if(nextApprover==-1){
			this.nextApprover = -1;
			approvers.clear();
		}else{
			this.nextApprover = nextApprover;
			approvers.add(nextApprover);
		}
	}
	public List<Long> getApprovers() {
		return approvers;
	}
		
	public String toString(){
		
		return smsObjId+"\t\t"+ description +"\t\t"+ cost +"\t\t"+SMSUtil.formatDate(startDate)+"\t\t\t"+SMSUtil.formatDate(endDate)+"\t\t\t"+shippingAddress+"\t\t\t"+currentState.getStateName() + "\t\t"+currentLevel+"\t\t"+maxLevel+"\t\t"+SMSUtil.getTBD(this);
	}

}
